<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   design_blank
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
?>
<?php  $_orderSummary = $this->getOrder() ?>
<?php  $_order = $_orderSummary['order'] ?>
<?php $_currency = $_order['currency_symbol'] ? $_order['currency_symbol']: $_order['currency']?>

<div class="page-title">
    <h2><?php echo $this->__('Order') ?> #<?php echo $_order['orders_id'] ?></h2>
</div>
<p><?php echo $this->__('Order Date:')?> <?php echo $this->formatDate($_order['date_purchased'], 'medium', false) ?></p>

<div class="col2-set">
    <div class="col-1">
        <h3><?php echo $this->__('Shipping Address') ?></h3>
        <address>
<?php echo $_order['delivery_name'] ?><br />
<?php echo $_order['delivery_street_address'] ?><br />

<?php echo $_order['delivery_city'].' , '.$_order['delivery_postcode'].', '.$_order['delivery_state'] ?><br />
<?php echo $_order['delivery_country'] ?><br />
T: <?php echo $_order['customers_telephone'] ?>

            </address>
    </div>
    <?php if (isset($_orderSummary['total'])) {
        foreach ($_orderSummary['total'] as $_total) {
            if ($_total['class'] == 'ot_shipping') {
                $_shippingMethod = str_replace(':','',$_total['title']);
            }
        }
    }
    ?>
    <?php if (isset($_shippingMethod)) :?>
    <div class="col-2">
        <h3><?php echo $this->__('Shipping Method') ?></h3>
        <?php echo $_shippingMethod?>
    </div>
    <?php endif; ?>
</div>

<div class="subcolumns">
  <div class="c50l">
    <div class="subcl">
        <h3><?php echo $this->__('Billing Address') ?></h3>
        <address>
          <?php echo $_order['billing_name'] ?><br />
          <?php echo $_order['billing_street_address'] ?><br />
          
          <?php echo $_order['billing_city'].' , '.$_order['billing_postcode'].', '.$_order['billing_state'] ?><br />
          <?php echo $_order['billing_country'] ?><br />
          T: <?php echo $_order['customers_telephone'] ?>
        </address>
    </div>
  </div>

  <div class="c50r">
    <div class="subcr">
        <h3>Payment Method</h3>
        <?php echo $_order['payment_method'] ?>
    </div>
  </div>
</div> 

<h3><?php echo $this->__('Items Ordered') ?></h3>

<table id="my-orders-table" class="data-table">
    <col />
    <col width="1" />
    <col width="1" />
    <col width="1" />
    <col width="1" />
    <thead>
        <tr class="first last">
            <th><?php echo $this->__('Product Name') ?></th>
            <th><?php echo $this->__('SKU') ?></th>
            <th><?php echo $this->__('Price') ?></th>
            <th><?php echo $this->__('Qty Ordered') ?></th>
            <th><?php echo $this->__('Subtotal') ?></th>
        </tr>
    </thead>
    <?php if (isset($_orderSummary['products'])): ?>
    <tbody>
        <?php foreach($_orderSummary['products'] as $product) :?>
        <tr id="order-item-row-3">
           <td><?php echo $product['products_name'] ?></td>
           <td><?php echo $product['products_model'] ?></td>
           <td><span><?php echo  $_currency.' '.number_format($product['products_price'],2) ?></span> </td>
           <td><?php echo $product['products_quantity'] ?></td>
           <td><span><?php echo  $_currency.' '.number_format($product['final_price'],2) ?></span> </td>
        </tr>
        <?php endforeach; ?>
    </tbody>
    <?php endif; ?>
    <?php if (isset($_orderSummary['total'])) :?>
    <?php $count = 1; $_total = sizeof($_orderSummary['total']); ?>
    <tfoot>
        <?php foreach ($_orderSummary['total'] as $total) :?>
        <tr class="<?php echo ($count == 1? 'first': ($count == $_total ? 'last' :'')) ?>">
            <td colspan="4"><?php echo $total['title'] ?></td>
            <td><?php echo $_currency.' '.number_format($total['value'],2) ?></td>
        </tr>
            <?php $count++; ?>
        <?php endforeach; ?>
     </tfoot>
     <?php endif; ?>
</table>

<?php if (isset($_orderSummary['history'])): ?>

    <h3><?php echo $this->__('About Your Order') ?></h3>
    <dl>
        <?php foreach ($_orderSummary['history'] as $_historyItem): ?>
            <dt><?php echo $this->formatDate($_historyItem['date_added'], 'medium', true) ?> | <?php echo $_historyItem['orders_status'] ?> </dt>
            <dd><?php echo $_historyItem['comments'] ?></dd>
        <?php endforeach; ?>
    </dl>
<?php endif; ?>
<div class="buttons-set"><div class="floatbox">
    <a href="<?php echo $this->getBackUrl() ?>" class="back-link">&laquo; <?php echo $this->__('Back to My Orders') ?></a>
</div></div>
